package com.example.demo.web.Controller;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.context.request.async.DeferredResult;

import com.example.demo.web.services.SysService;


@Controller
public class SysController {
	private SysService sysService;
    @Autowired
    public void setRightService(SysService sysService){
        this.sysService = sysService;
    }
    
    @RequestMapping(value="/getSyslist",method=RequestMethod.GET,produces="text/html;charset=UTF-8;") 
	public @ResponseBody String getSyslist(HttpSession session) throws IOException{

		System.out.println("---------------------->>>>getSyslist");
		return sysService.getSyslist(session);
		
	}
    
    @RequestMapping(value="/sys_edit",method=RequestMethod.POST,produces="text/html;charset=UTF-8;") 
   	public @ResponseBody DeferredResult<String> sys_Edit(@RequestBody String objnode, HttpServletRequest request, HttpSession session) throws IOException{	    	
    	DeferredResult<String> deferredResult = new DeferredResult<String>();
   		sysService._sys_Edit(deferredResult,objnode,request, session);	
   		return deferredResult;
   	}
}
